*** Settings ***
Documentation           通过Redfis获取门限传感器的资源列表
Resource                ../../test_function/redfish/redfish.robot
Resource                ../../test_function/resource.robot
Library                 RequestsLibrary
Library                 Collections
Library                 BuiltIn
Suite Setup             Create REDFISH_GET Session
Suite Teardown          Delete All Sessions

*** Variables ***
${INPUT_URI}            /Chassis/${CHASSIS_ID}/ThresholdSensors

*** Test Cases ***
Get ThresholdSensors List Via Redfish
    [Documentation]    通过Redfish查询门限传感器的资源列表
    [Tags]    Get_ThresholdSensors_List_Via_Redfish
    # 发送GET请求
    ${rsp}=    Run Keyword And Ignore Error    GET On Session    redfish_get    ${INPUT_URI}

    Run Keyword If     '${rsp[0]}' == 'FAIL'    Fail    msg=获取门限传感器资源列表失败: ${rsp[1]}

    # 验证响应状态码
    Should Be Equal As Strings    ${rsp[1].status_code}    ${SUCCESS_CODE}    msg=预期状态码200,实际收到${rsp[1].status_code}

    # 打印响应内容
    Log    ${rsp[1].json()}    level=INFO

    # 验证ThresholdSensors
    ${output_settings}=    Set Variable    ${rsp[1].json()}
    ${Name}=    Set Variable    ThresholdSensors

    # 检查响应中是否包含ThresholdSensors
    Should Contain    ${output_settings['Name']}    ${Name}
    Log    门限传感器的名称为: ${output_settings['Name']}    level=INFO
